home *** CD-ROM | disk | FTP | other *** search
/ MacHome 2001 May / MacHome CD (May 2001).iso / mac / Stuff / Software / Tools / Black & Bleu™ 3.0 / For Developers / Read about BleuRoseErrorLib next >
Encoding:
Text File  |  2000-12-27  |  13.6 KB  |  164 lines  |  [TEXT/ttxt]

  1. Contents
  2. Introduction
  3. Files in this kit
  4. Licensing the Error Library
  5. Completing the Library
  6. Calling the Library
  7. Incorporating the Library into Your Own Application
  8. Customizing the Error Library
  9. User System Requirements
  10. Developer System Requirements
  11. Version History
  12.  
  13. Introduction
  14. The files in this folder represent the error database contained in Black & Bleu™, our commercial error analysis application. Using the information found in this folder, you can incorporate the most comprehensive Mac OS error list ever compiled into your own application. This document describes version 3.0 of the runtime library. V3.0 is the first public release of this offering.
  15.  
  16. The library database consists of 5,045 error codes, Apple's pneumonic name for each, the technology associated with each error code (such as QuickTime, AppleScript, Memory Manager, etc.) and Apple's short description of what the error means.
  17.  
  18. The BleuRoseErrorLib file is a hybrid Shared Library file. That means it is compatible with both PowerPC native applications as well as classic 68k code. This single library can be linked to your application whether it is Classic 68k, PowerPC Native or FAT. A context switch is not required when the library is called since the library is smart enough to activate the proper code for the mode you are currently in (68k or PPC).
  19.  
  20. This concept was first described by Joe Zobkiw in his book "A Fragment of Your Imagination", 1995, Addison Wesley, ISBN #0-201-48358-0.
  21.  
  22. Note: Neither Native Mac OS X support (Cocoa) nor Carbon support is not provided in this release. If you are interested in either of these technologies, let us know. Unless there is some interest expressed in Carbon and Cocoa support, we don't plan on providing it.
  23.  
  24. Files in this kit
  25.  Read about BleuRoseErrorLib            The file you are currently reading
  26. BleuRoseErrorLib                               See "Incorporating the Library ..." below
  27. BleuRoseErrorLib License                  Print, sign and mail this document
  28. Populate The Library                          See "Completing the Library" (below)
  29. Usage Example                                   A Folder that contains:
  30.    BleuRoseErrorLib                            An Alias for the real library (above)
  31.    BleuRoseErrorLibSample PPC          Pre-built sample applicaiton (PPC)
  32.    BleuRoseErrorLibSample 68k          Pre-built sample applicaiton (68k)
  33.    BleuRoseErrors.c                            Sample application source code
  34.    BleuRoseErrors.h                            Sample application source code
  35.    Calling The Library.mcp                  CodeWarrior/PRO v5.3 project file
  36.    main.c                                             Sample application source code
  37.    main.rsrc                                        Sample application resources
  38.  
  39. Licensing the Error Library
  40. The Bleu Rose Error Library  requires a license (and a key) to be fully functional. The unlicensed library contains all of the available error codes. However, until the library is licensed, the contents of the STR 29271 resource will be substituted for Apple's explanation until a valid license key is added to the library. As delivered, that substitute string reads: "of an undescribed problem".
  41.  
  42. The terms of the license are as follows:
  43. 1) You agree to provide Bleu Rose Limited 2 fully licensed and functional copies of any software that incorporates BleuRoseErrorLib.
  44. 2) You agree to provide Bleu Rose Limited 2 fully functional sets of any hardware that accompanies the software described by item 1 above. If your software requires no hardware (other than a standard Macintosh), you are not required to provide any hardware.
  45. 3) You agree to disclose to Bleu Rose Limited the expected completion date and version number of the software described by item 1 above. This information will be restricted to those parties who signed the licensing agreement.
  46. 4) You agree to update our copies of your software at no charge to us as you release new versions of any software incorporating our error library.
  47. 5) You agree to let us use your company and/or product name in our own advertising without restriction upon formal release of your product.
  48.  
  49. To license the library, fill out the form found in the file titled "BleuRoseErrorLib License". Send 2 signed copies to us at:
  50.                                              Bleu Rose Ltd.
  51.                                      attn: Licensing
  52.                                              P. O. Box 5536
  53.                                              Hacienda Heights, CA  91745-0536
  54.                                              USA
  55.  
  56. We will send one copy back to you with our part signed as well. We will also include your license key with the signed document.
  57.  
  58. When you receive your license key, open the file BleuRoseErrorLib with a resource editor. Replace the contents of the 'LKey' resource with the key you received. The key will be 24 characters long. 'LKey' is defined as a Pascal string. Thus, the actual size of the resource will be 25 bytes. Verify this size after you replace the default key with your own. If the size of the resource isn't exactly 25 bytes, the software will return the kWarningLibraryNotLicensed error even though you have a valid license key.
  59.  
  60. Completing the Library
  61. To keep the size of the electronic download reasonably small, we have included the error database in a single location ONLY (inside the Black & Bleu™ application itself). You will need to move that database into the BleuRoseErrorLib file before you use the library. An application called "Populate The Library" has been included in your package for this purpose. Run the application and follow the instructions it displays. This activity needs to be done only once.
  62.  
  63. Calling the Library
  64. Apple, mostly through lack of organization, has come up with a rather incoherent collection of error numbers. Many are used over and over again with different meanings for each occurrence. For example,  error 1 has more than 20 distinct meanings ranging from the traditional "Bus Error" to the rather obscure Apple Realtime Operating System Environment (AROSE) "Die Abort" error.
  65.  
  66. The Bleu Rose Library deals with this situation by placing each instance of the error on a separate list. When you ask for the error description, the lists will be searched until the error is found. While the software attempts to search the lists using a "most common to least common" algorithm, your definition of "most common"  may differ from the one we used.
  67.  
  68. You can alter this search behavior by specifying the type of error you suspect the error to be. In that case, the search will continue until a match of the error type AND the error number occurs. If the search fails to match EITHER criteria, an error is returned. If the search finds the error but not the specified error type, a warning is returned along with the valid information for the error that WAS found.
  69.  
  70. A sample CodeWarrior Project is provided that illustrates how to call the library.
  71.  
  72. To use the library, your application must:
  73. 1) locate it
  74. 2) make it the current resource file
  75. 3) fill in the code resource's parameter block
  76. 4) extract the library's code resource
  77. 5) call the code resource
  78. 6) interpret the results
  79.  
  80. Sample code is provided (in source form) showing how to access the library and call it. Source for the library itself (the code resource) is not included.
  81.  
  82. There are 2 functions provided in source code form that show you how to perform the above steps.
  83.  
  84. FindBleuRoseErrorLibrary locates the library
  85. CallBleuRoseErrorLibrary opens the library and looks up the error
  86.  
  87. The library itself has only 1 entry point. It requires a parameter block pointer that contains everything the library needs to return the desired data.
  88.  
  89. The parameter block is used as follows:
  90. To obtain the description of an error given the error number, fill in the parameter block as follows:
  91. Out-In Name                                   Type       Description
  92.    ->  action                                 SInt32     Set to kGetError
  93.    ->  error                                  SInt32     The error number to look up
  94.    ->  proposedErrorTypeNumber    SInt16     The Error Type value to try
  95.   <-   actualErrorTypeNumber      SInt16     The Error Type value matching the error found
  96.   <-   errorTypeName                    Str255     Name string matching the Error Type number
  97.   <-   pneumonic                           Str255     Apple's name for this error
  98.   <-   description                         Str255     Apple's explanation of this error
  99.  
  100. The proposedErrorTypeNumber value is a number from 0 (k1stErrorTypeFound) through kZlastType-1. If you use a value of zero (k1stErrorTypeFound), the data returned will match the first occurrence of the error found in the database. This value SHOULD be the most common reason for the error. However, the definition of "most common" is subjective. It is based on the number of times that the error has been encountered at Bleu Rose Ltd. Obviously, we have not encountered all of the errors in actual code. Thus, without any data to go on, errors are ranked rather arbitrarily - typically in the order they were discovered.
  101.  
  102. To assist you in the ranking of an error, you can assign a ranking by using the proposedErrorTypeNumber field to specify a "guess" about the source of the error. For example, assume that you have received a -1 error value back from a function call. The "most common" meaning of this error is a "General System" error. And if you specified k1stErrorTypeFound in the proposedErrorTypeNumber field, you would get back a description of that error type. But in this case, say you were calling a printing function. Thus, it would be likely that the error value returned would be related to printing. To get a description that is more likely to fit your circumstance, you would fill in the proposedErrorTypeNumber field with kPrintingType. The description returned would then be correct for a printing error.
  103.  
  104. In the event that you guessed wrong and the error was NOT associated with printing, you would get back the "most common" description along with a warning status of kErrorTypeNotOnFile.
  105.  
  106. In every case, the actual error type found will be returned in the actualErrorTypeNumber field. The errorTypeName field will also contain the string matching the value returned in the actualErrorTypeNumber field.
  107.  
  108. If the error number can't be found at all, an error status of kErrorNotOnFile will be returned and the rest of the  variables in the parameter block will be set to 0 or left empty.
  109.  
  110. To obtain the description of an error type given the error type number, fill in the parameter block as follows:
  111. Out-In Name                                   Type       Description
  112.    ->  action                                 SInt32    Set to kGetType
  113.    ->  error                                  SInt32    (Not Used)
  114.    ->  proposedErrorTypeNumber    SInt16    The Error Type value to try
  115.   <-   actualErrorTypeNumber      SInt16    (Not Used)
  116.   <-   errorTypeName                    Str255    Name string matching the Error Type number
  117.   <-   pneumonic                           Str255    (Not Used)
  118.   <-   description                         Str255    (Not Used)
  119.  
  120. If the error type number is not on file, a status of kErrorTypeNotOnFile will be returned.
  121.  
  122. Incorporating the Library into Your Own Application
  123. You may choose to include the library as part of your application rather than shipping it as a separate file. To do so, simply add the library to your project. The sample program included in this collection uses that technique.
  124.  
  125. WARNING: The resource IDs used in the library must NOT be changed. If you do, the library's code resource will not work. Be sure to take note of any "Duplicate Resource" warnings issued by the linker. If you receive any, change the IDs of YOUR resources to eliminate the duplicate resource problem.
  126.  
  127. Note: The library uses resource ID 29271 (defined as kBleuRoseErrorLibCommonResID) for ALL of its resource IDs.
  128.  
  129. You may leave the file "as is" and simply include it as a separate file in your product's collection of files. The sample code illustrates how to "find" the library both in the same folder that contains your application and the system Extensions folder. If you choose to place the file in some other location, you will need to alter the sample code accordingly.
  130.  
  131. Note: BleuRoseErrorLib is NOT a true shared library. The file type is 'rsrc' rather than 'shlb'. As such, placing the file into the Extensions folder offers no particular advantage to you or your customers until you include it in more than one of your applications. If you use BleuRoseErrorLib in more than 1 application, each can reference the same copy of the library.
  132.  
  133. The longest pneumonic is 65 bytes long. It is associated with error -26695. The longest description is 207 bytes long. It is associated with error -3172.
  134.  
  135. Customizing the Error Library
  136. In many cases, Apple has not provided any explanation at all for an error. For those cases, the contents of the STR 29271 resource will be substituted for the missing explanation. As delivered, the string reads: "of an undescribed problem". You may change this string to anything else you want to use.
  137.  
  138. Note: Apple's explanations have been modified to complete the following sentence correctly:
  139. "An error occurred because ". 
  140.  
  141. User System Requirements
  142. BleuRoseErrorLib is designed to operate correctly on a User's machine if the following is available:
  143. - Mac OS 7.0 or later
  144. - 600 kB RAM
  145. - 300 kB of Disk Space
  146.  
  147. Developer System Requirements
  148. BleuRoseErrorLib is designed to be used with:
  149. CodeWarrior v5.3 or newer using the C or C++ compilers
  150. Apple Universal Headers v3.2 or newer
  151.  
  152. and requires:
  153. - 500 kB of Disk Space
  154. - 600 kB of RAM
  155.  
  156. Variations of this environment will probably work but may require small changes in the source code and the creation of your own CodeWarrior project file to build the sample project.
  157.  
  158. The library does NO checking for these requirements. It is your responsibility to validate the environment before using BleuRoseErrorLib.
  159.  
  160. Version History
  161. v1.0  - Released in January 2001
  162.  
  163. Rev. December 27, 2000
  164.